﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TrucksDir.Data;
using TrucksDir.Data.Services;
using TrucksDir.Resources;

namespace TrucksDir.Controllers
{
    public class TrucksController : Controller
    {

        public TrucksController()
        {
           
        }

        public ActionResult AddTruck()
        {
            return RedirectToAction("Create", "Trucks");
        }

        public ActionResult Create()
        {
            item newItem = new item();
            newItem.type = null;
            return View(newItem);
        }

        [HttpPost]
        public ActionResult Create(item it)
        {
            it.CheckForRadios(ModelState);
            if (ModelState.IsValid)
            {
               
                //return Redirect("/");
                //try
                //{
                //    ItemDAO.InsertOnSubmit(it);
                //    it.SubmitChanges();
                //}
                //catch (Exception ex)
                //{

                //}
            }

            return View(it);
        }

        [HttpPost]
        public ActionResult Update(item it)
        {
            return View(it);
        }

    }
}
